DEFINE CLASS dataautores as databaseclass
	
	vapellido = ""
	vnombre = ""
	vidautor = 0
	
	FUNCTION insert as Boolean
		
		INSERT INTO autor (apellido, nombre) ;
		VALUES (this.vapellido, this.vnombre)
		IF _Tally > 0 then
		RETURN .T.
		ELSE 
		RETURN .F.
		ENDIF
		
	ENDFUNC
	
	FUNCTION update AS Boolean
	
		update autor set ;
		apellido = this.vapellido, ;
		nombre = this.vnombre ;
		where idautor = this.vidautor
		IF _Tally > 0 then
		RETURN .T.
		ELSE 
		RETURN .F.
		ENDIF
		
	ENDFUNC
	
	FUNCTION delete AS Boolean
	
	SET DELETED OFF
	delete from autor where idautor = this.vidautor
	IF _Tally > 0 then
		RETURN .T.
		ELSE 
		RETURN .F.
		ENDIF
		
	ENDFUNC
		
	FUNCTION getone AS Boolean
		PARAMETERS bidautor

		select * from autor where idautor = bidautor into cursor curAutBuscado
		
		this.vapellido = curAutBuscado.apellido
		this.vnombre = curAutBuscado.nombre
		this.vidautor = curAutBuscado.idautor
		IF _Tally > 0 then
		RETURN .T.
		ELSE 
		RETURN .F.
		ENDIF
		
	ENDFUNC
	
	FUNCTION getall AS Boolean
		
		SELECT * FROM autor INTO CURSOR vcurautores
		
		IF _Tally > 0 then
		RETURN .T.
		ELSE 
		RETURN .F.
		ENDIF
		
	ENDFUNC

enddefine